package State;

public class NetConnect implements Context {
    private TCPState tcpState = Listening.getInstance();
    @Override
    public void setState(String state) {
        if (state.equals("established")) {
            changeState(Established.getInstance());
        } else if (state.equals("listening")) {
            changeState(Listening.getInstance());
        } else {
            changeState(Closed.getInstance());
        }
    }
    @Override
    public void changeState(TCPState t) {
        tcpState = t;
    }
    @Override
    public void reaction() {
        tcpState.doReaction();
    }
}
